#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;

const int N = 2e5 + 10;

int n, ans[N], fa[N];
vector<pii> g[N];

int find(int x) {
    return fa[x] > 0 ? fa[x] = find(fa[x]) : x;
}

int q[N];
bool vis[N];

int solve(int u, int t) {
    fill(vis + 1, vis + n + 1, false);
    fill(q + 1, q + n + 1, 0);
    q[t] = u;
    vis[0] = true;
    int ret = 0;
    for(int i = t; i <= n; i ++) {
        int u = q[i];
        if(vis[u]) continue;
        vis[u] = true;
        ret ++;
        for(auto &[v, w] : g[u])
            if(w > i)
                q[w] = v;
    }
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;

    fill(fa + 1, fa + n + 1, -1);
    fill(ans + 1, ans + n + 1, 1);

    vector<pii> e(n);
    for(int i = 1; auto &[u, v] : e) {
        cin >> u >> v;
        g[u].emplace_back(v, i);
        g[v].emplace_back(u, i);
        i ++;
    }

    for(int i = n - 1; i >= 0; i --) {
        int u = e[i].first, v = e[i].second;
        if(find(u) != find(v)) {
            ans[u] = ans[v] += ans[u];
            
            u = find(u);
            v = find(v);
            if(fa[u] < fa[v]) swap(u, v);
            fa[v] += fa[u];
            fa[u] = v;
        }else{
            ans[u] = solve(u, i);
            ans[v] = solve(v, i);
        }
    }

    for(int i = 1; i <= n; i ++)
        cout << ans[i] << " \n"[i == n];
    return 0;
}